<swal title="Delete?"
      [text]="'Setting \'' + setting?.key + '\' will be deleted permanently. This action cannot be reversed.'"
      type="warning"
      [showCancelButton]="true"
      (confirm)="delete()"
      #deleteAlert>
</swal>
<div class="row">
    <div class="col-12">
        <div class="card m-b-30 m-t-30">
            <div class="card-body">
                <h4 class="mt-0 header-title">Edit Setting</h4>
                <p class="text-muted m-b-30 font-14">
                    Here you can modify an application setting.
                </p>
                <form class="needs-validation"
                      [ngClass]="{ 'was-validated': form.submitted }"
                      (ngSubmit)="form.form.valid && update()"
                      novalidate
                      #form="ngForm">
                    <div class="form-group row">
                        <label for="setting-name"
                               class="col-sm-2 col-form-label">
                            Name
                        </label>
                        <div class="col-sm-10 col-form-label">
                            <span class="col-form-label"
                                  id="setting-name"
                                  name="setting-name">
                                {{ setting.key }}
                            </span>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="setting-value"
                               class="col-sm-2 col-form-label">
                            Value
                        </label>
                        <div class="col-sm-10">
                            <input id="setting-value"
                                   name="setting-value"
                                   class="form-control"
                                   rows="3"
                                   maxlength="2048"
                                   required
                                   [(ngModel)]="setting.value"
                                   #value="ngModel" />
                            <div *ngIf="form.submitted && value.invalid"
                                 class="form-control-feedback text-danger">
                                Field 'Value' is required.
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div>
                            <button type="submit"
                                    class="btn btn-primary m-r-5">
                                Save Changes
                            </button>
                            <button type="button"
                                    class="btn btn-danger m-r-5 float-right"
                                    (click)="deletePrompt()">
                                Delete
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>